package com.gitee.dolt.utils;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileTypeUtil;

import java.io.File;
import java.util.Set;

public class FileTypeUtils {

    private static Set<String> VIDEO_FORMAT = CollUtil.newHashSet("rm", "rmvb", "3gp", "flv", "mp4", "mpeg", "mpg", "mkv", "wmv", "wav", "avi", "mid", "mov", "ram", "asf", "dat",
            "ogg", "ogm");

    /**
     * 是否视频文件
     *
     * @param file
     * @return
     */
    public static boolean isVideo(File file) {
        String type = FileTypeUtil.getType(file);
        return VIDEO_FORMAT.contains(type);
    }
}
